Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(config): update mypy configuration #117

Merged
merged 9 commits into from
Oct 7, 2024

Conversation

abhijeetSaroha
Copy link
Collaborator

Solves #116

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@abhijeetSaroha
Copy link
Collaborator Author

There is linter error in this line, related to subscriptable.

AppConfigType: TypeAlias = Dict[str, Union[str, List[str]]]

(suggestion from Claude)
The linter error occurs because built-in types like dict and list are not subscriptable in Python versions prior to 3.9 when used in type annotations. To ensure compatibility with Python 3.8 and earlier, we should use Dict and List from the typing module instead of the built-in types. If you're using Python 3.9 or later, this issue won't occur, as built-in types become subscriptable in those versions.

@xmnlab
Copy link
Member

xmnlab commented Oct 3, 2024

https://github.com/osl-incubator/makim/actions/runs/11099645303/job/30834203281?pr=117#step:6:17

@abhijeetSaroha for cast, you will still need to use List, Tuple, Dict from typing .. for the other usages, please keep using list, dict, and tuple

@abhijeetSaroha
Copy link
Collaborator Author

Ok...I will do that and will update you.

@abhijeetSaroha abhijeetSaroha changed the title fix: update the config mypy fix(config): update mypy configuration Oct 4, 2024
@xmnlab
Copy link
Member

xmnlab commented Oct 4, 2024

@abhijeetSaroha could you rebase this branch on top of upstream main please?

@abhijeetSaroha
Copy link
Collaborator Author

abhijeetSaroha commented Oct 4, 2024

I've successfully rebased the branch on top of the upstream main.

Regarding the other PR, thank you for merging it! The tests for the post-run are already in place.

https://github.com/osl-incubator/makim/blob/main/tests/smoke/.makim-hooks.yaml#L23C1-L36C32

Is it OK ?

@xmnlab
Copy link
Member

xmnlab commented Oct 6, 2024

I've successfully rebased the branch on top of the upstream main.

Regarding the other PR, thank you for merging it! The tests for the post-run are already in place.

https://github.com/osl-incubator/makim/blob/main/tests/smoke/.makim-hooks.yaml#L23C1-L36C32

Is it OK ?

for some reason I missed that. that is ok. appreciate that!


def get_terminal_size(
default_size: Tuple[int, int] = (80, 24),
) -> Tuple[int, int]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be tuple if you import from __future__ import annotations
but I will not block this PR to be merged because of this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually there are two more changes for this PR before it is ready to go .. so please could you already fix this one as well?


return env, variables

def _load_scoped_vars(self, scope: str, env) -> dict:
def _load_scoped_vars(self, scope: str) -> Any:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that this should be a dict[str, Any]

Suggested change
def _load_scoped_vars(self, scope: str) -> Any:
def _load_scoped_vars(self, scope: str) -> dict[str, Any]:

and in order to fix the issue with the return

I think it should be something like this: return cast(Dict[str, Any], fix_dict_keys_recursively(variables))

it is still not perfect .. but I will think some ways to improve fix_dict_keys_recursively .. but for now please do this change.

@@ -434,19 +437,22 @@ def _load_scoped_vars(self, scope: str, env) -> dict:

return fix_dict_keys_recursively(variables)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return fix_dict_keys_recursively(variables)
return cast(Dict[str, Any], fix_dict_keys_recursively(variables))


def get_terminal_size(
default_size: Tuple[int, int] = (80, 24),
) -> Tuple[int, int]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually there are two more changes for this PR before it is ready to go .. so please could you already fix this one as well?

Copy link
Member

@xmnlab xmnlab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! thanks for working on that, @abhijeetSaroha

@xmnlab xmnlab merged commit f2bf92e into osl-incubator:main Oct 7, 2024
14 checks passed
Copy link

github-actions bot commented Oct 8, 2024

🎉 This PR is included in version 1.17.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@abhijeetSaroha abhijeetSaroha deleted the config-mypy branch October 10, 2024 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants